<template>
  <div class="widget">
    <p class="widget-title">{{ content.display_name }}</p>
    <el-input
      type="textarea"
      class="val"
      :rows="10"
      placeholder="请输入内容"
      @focus="showEditor = true; defaultValue = content.defaultValue"
      @change="sendValue"
      v-model="content.defaultValue" />
    <el-dialog
      title=" "
      :visible.sync="showEditor">
      <code-editor
        :style="{ height: `${h}px` }"
        ref="jsonEditor"
        mode="python"
        v-model="defaultValue" />
      <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitReject">确认</el-button>
				<el-button class="none-type" @click="showEditor = false">关 闭</el-button>
			</span>
    </el-dialog>
  </div>
</template>
<script>
import CodeEditor from "@/components/module/CodeEditor";

export default {
  props: { },
  data() {
    return {
      content: {},
      defaultValue: '',
      showEditor: false,
      h: 500
    };
  },
  components: {
    CodeEditor,
  },
  methods: {
    sendValue() {
      this.$EventBus.$emit('defaultValue', this.content)
      console.log(123123)
    },
    submitReject() {
      console.log(123)
      this.content.defaultValue = this.defaultValue
      this.showEditor = false
    }
  },
  mounted () {
    
  }
};
</script>

<style lang="less" scoped>
.val{
  width: 180px;
}
</style>
